package com.rd.student.jiaji.class2.shirui.arrtest;

import java.util.Arrays;

public class TestArrSort {
    public static void main(String[] args) {
        int[] arr = new int[]{3, 5, 7, 1, 2, 9};
        downOrder(arr);
    }

    public static void downOrder(int[] arr) {

        for (int i = 0; i < arr.length - 1; i++) {
            boolean isSorted = true;

            for (int j = 0; j < arr.length - i - 1; j++) {

                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                    isSorted = false;
                }
            }
            if (isSorted){
                break;
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}


